<template>
	<!-- 临时加的，车辆交接信息，临时数据 -->
	<div style="height: 100%;">
		<div class="edit-top">
			车辆交接班信息
			<i class="el-icon-close" @click='cancel'></i>
		</div>
		<div class="history-content">
			<el-form :inline="true"  class="demo-form-inline" style="margin-top: 20px;">
			  <el-form-item label="车主姓名">
			    <el-input v-model="name" class="inputwidth1"  readonly="readonly"></el-input>
			  </el-form-item>
			  <el-form-item label="余额">
			    <el-input v-model="money" class="inputwidth1" readonly="readonly"></el-input>
			  </el-form-item>

			    <el-form-item label="联系方式">
			      <el-input v-model="contact" class="inputwidth1" readonly="readonly"></el-input>
			  </el-form-item>
			  <el-form-item label="车牌号">
			      <el-input v-model="chepai" class="inputwidth1" readonly="readonly"></el-input>
			  </el-form-item>
			  <el-form-item label="隶属公司">
			      <el-input v-model="company" readonly="readonly"></el-input>
			  </el-form-item>
			</el-form>
			<el-table :data="tableData"  show-header stripe style="width: 100%;">
				<el-table-column prop="date" label="日期" >
				</el-table-column>
				<el-table-column prop="time" label="时间" >
				</el-table-column>
				<el-table-column prop="xiangmu" label="项目" width="80">
				</el-table-column>
				<el-table-column prop="people" label="交/接人" width="100">
				</el-table-column>
				<el-table-column prop="cost" label="交车费用" width="200" >
				</el-table-column>
				<el-table-column prop="battery" label="电池剩余电量" width="200">
				<template slot-scope="scope">
					
					  <img v-if="scope.row.battery <= 20"  src="@/assets/img/battery1.png" alt="">
					  <img v-if="scope.row.battery > 20 && scope.row.battery <= 40"  src="@/assets/img/battery2.png" alt="">
					  <img v-if="scope.row.battery > 40 && scope.row.battery <= 60"  src="@/assets/img/battery3.png" alt="">
					  <img v-if="scope.row.battery > 60 && scope.row.battery <= 80"  src="@/assets/img/battery4.png" alt="">
					  <img v-if="scope.row.battery > 80 "  src="@/assets/img/battery5.png" alt="">
					</template>

				</el-table-column>
				<el-table-column prop="batterycode" label="电池编号" width="100">
				</el-table-column>
				<el-table-column prop="batterychange" label="是/否换电池" width="100">
				</el-table-column>
				<el-table-column prop="batterychangedate" label="换电池时间" width="200">
				</el-table-column>
				<el-table-column prop="batterychangecode" label="更换电池编号" width="200">
				</el-table-column>
			</el-table>
		</div>
		<div class="edit-bottom">
			<span @click='cancel'>取消</span>
		</div>
	</div>
</template>

<script>
	import Global from '@/components/Global.vue'
	export default {
		props: ['id'],

		data() {
			return {
				name:'林成林',
				contact:'13854569865',
				chepai:'浙C90909',
				company:'佳通汽车租赁有限公司',
				money:'1000元',
				dict: '',
				is_ok: true,
				processId:'',
				tableData:[
					{
						'date':'2020-05-04',
						'time':'17:32:43',
						'xiangmu':'交车',
						'people':'王五',
						'cost':'【本次交车未产生费用】',
						'battery':'5',
						'batterycode':'EU-200',
						'batterychange':'是',
						'batterychangedate':'2020-05-04 17:33:34',
						'batterychangecode':'DW-200'
						
						
						
					},
					{
						'date':'2020-05-14',
						'time':'15:42:43',
						'xiangmu':'接车',
						'people':'柳宗元',
						'cost':'【本次交车未产生费用】',
						'battery':'35',
						'batterycode':'EU-200',
						'batterychange':'否',
						'batterychangedate':'',
						'batterychangecode':''
					},
					{
						'date':'2020-05-17',
						'time':'15:42:43',
						'xiangmu':'交车',
						'people':'王五',
						'cost':'【本次交车未产生费用】',
						'battery':'75',
						'batterycode':'EU-200',
						'batterychange':'否',
						'batterychangedate':'',
						'batterychangecode':''
					},
					{
						'date':'2020-06-01',
						'time':'07:32:43',
						'xiangmu':'交车',
						'people':'柳宗元',
						'cost':'50元',
						'battery':'40',
						'batterycode':'EU-200',
						'batterychange':'是',
						'batterychangedate':'2020-06-01 17:33:34',
						'batterychangecode':'DW-200'
						
						
						
					},
					{
						'date':'2020-06-02',
						'time':'15:42:43',
						'xiangmu':'接车',
						'people':'柳宗元',
						'cost':'34元',
						'battery':'35',
						'batterycode':'DW-200',
						'batterychange':'否',
						'batterychangedate':'',
						'batterychangecode':''
					},
					{
						'date':'2020-06-03',
						'time':'15:42:43',
						'xiangmu':'交车',
						'people':'王五',
						'cost':'60元',
						'battery':'75',
						'batterycode':'DW-200',
						'batterychange':'否',
						'batterychangedate':'',
						'batterychangecode':''
					},
					{
						'date':'2020-06-04',
						'time':'07:32:43',
						'xiangmu':'交车',
						'people':'柳宗元',
						'cost':'50元',
						'battery':'40',
						'batterycode':'EU-200',
						'batterychange':'是',
						'batterychangedate':'2020-06-04 17:33:34',
						'batterychangecode':'DW-200'
						
						
						
					},
					{
						'date':'2020-06-06',
						'time':'08:32:43',
						'xiangmu':'移车',
						'people':'陈凤成',
						'cost':'50元',
						'battery':'100',
						'batterycode':'EU-200',
						'batterychange':'否',
						'batterychangedate':'',
						'batterychangecode':''
						
						
						
					},
					{
						'date':'2020-06-16',
						'time':'09:42:43',
						'xiangmu':'交车',
						'people':'王五',
						'cost':'50元',
						'battery':'9',
						'batterycode':'EU-200',
						'batterychange':'是',
						'batterychangedate':'2020-06-07 12:33:34',
						'batterychangecode':'DW-200'
						
						
						
					},
					{
						'date':'2020-06-04',
						'time':'07:32:43',
						'xiangmu':'交车',
						'people':'柳宗元',
						'cost':'50元',
						'battery':'40',
						'batterycode':'EU-200',
						'batterychange':'是',
						'batterychangedate':'2020-06-04 17:33:34',
						'batterychangecode':'DW-200'
						
						
						
					},
					{
						'date':'2020-06-06',
						'time':'08:32:43',
						'xiangmu':'移车',
						'people':'陈凤成',
						'cost':'50元',
						'battery':'100',
						'batterycode':'EU-200',
						'batterychange':'否',
						'batterychangedate':'',
						'batterychangecode':''
						
						
						
					},
					{
						'date':'2020-06-16',
						'time':'09:42:43',
						'xiangmu':'交车',
						'people':'王五',
						'cost':'50元',
						'battery':'9',
						'batterycode':'EU-200',
						'batterychange':'是',
						'batterychangedate':'2020-06-07 12:33:34',
						'batterychangecode':'DW-200'
						
						
						
					},
					{
						'date':'2020-06-17',
						'time':'07:32:43',
						'xiangmu':'交车',
						'people':'柳宗元',
						'cost':'50元',
						'battery':'40',
						'batterycode':'EU-200',
						'batterychange':'是',
						'batterychangedate':'2020-06-17 17:33:34',
						'batterychangecode':'DW-200'
						
						
						
					},
					{
						'date':'2020-06-18',
						'time':'08:32:43',
						'xiangmu':'移车',
						'people':'陈凤成',
						'cost':'50元',
						'battery':'100',
						'batterycode':'EU-200',
						'batterychange':'否',
						'batterychangedate':'',
						'batterychangecode':''
						
						
						
					},
					{
						'date':'2020-06-19',
						'time':'09:42:43',
						'xiangmu':'交车',
						'people':'王五',
						'cost':'50元',
						'battery':'9',
						'batterycode':'EU-200',
						'batterychange':'是',
						'batterychangedate':'2020-06-19 12:33:34',
						'batterychangecode':'DW-200'
						
						
						
					},
				]

			}
		},
		mounted() {
			this.get_history();
		},
		methods: {
			get_history(){
				var self = this;
				this.$axios.post(this.$global.serverIp + 'vehicle/handover/findHistory', {
				"source_id": self.id + ""
				  })
				  .then(function (res) {
					  if(res != ''){
						 self.tableData = res.data.list;
						 self.total = res.data.totalCount;
						 self.page = res.data.currPage;
					  }
						
				  })
				
			},
			cancel() {
				this.$emit("saveHistory", 1);
			}
		}
	}
	import '@/assets/css/edit.css'
</script>
